<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    *{
        padding: 0;
        margin: 0;
    }
    h1{
        width: 100%;
        height: 100vh;
        background-color: #808080;
        position: fixed;
        left: 0;
        top: 0;
    }
    p{
        text-align: center;
        margin: 0 auto;
    }
    div{
        display: none;
        width: 600px;
        height: 400px;
        margin: 150px auto;
        background: chartreuse;
    }
    div h3{
        box-sizing: border-box;
        width: 600px;
        height: 40px;
        background: cornflowerblue;
        text-align: right;
        line-height: 40px;
        color: #fff;
        padding-right: 30px;
    }
</style>
<body>
   <h1>
    <p><button>弹出层</button></p>
    <div>
        <h3><span>X</span></h3>
    </div>
   </h1>
</body>
</html>
<script>  var btn=document.querySelector('button')
    var div=document.querySelector('div')
    var sp=document.querySelector('span')
    btn.onclick=function(){
        div.style.display='block'
        btn.disabled=true
    }
    sp.onclick=function(){
        div.style.display='none'
        btn.disabled=false
    }
</script>